<script>
	import * as api from './utils/api.js';
	export default {
		globalData: {
			userInfo:{}, // 用户信息
			menuButtonInfo:null,// 胶囊位置信息
			systemInfo:{}, // 用户手机系统信息
			debugType:"false",// 调试模式
			version:'1.0.5', // 小程序版本号
			personList:{leader:[],participants:[],assignment:[]},// 人员选择临时存放列表
			info:{}, // 临时信息
			refreshPage:null,// 刷新页面标识
			address:null, // 地址信息
			selected:null,// 选中项标识
		},
		onLaunch: function() {
			let that = this;
			const updateManager = uni.getUpdateManager();

			updateManager.onCheckForUpdate(function (res) {
			  // 请求完新版本信息的回调
			  console.log(res.hasUpdate);
			});

			updateManager.onUpdateReady(function (res) {
			  uni.showModal({
			    title: '更新提示',
			    content: '新版本已经准备好，是否重启应用？',
			    success(res) {
			      if (res.confirm) {
			        // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
			        updateManager.applyUpdate();
			      }
			    }
			  });

			});

			const token = uni.getStorageSync('token');
			if(token){
				api.user({}).then(res=>{
					console.log('user',res.data);
					that.globalData.userInfo = res.data;
				});
			}
			console.log('App Launch')
		},
		onShow: function() {
			let that = this;
			uni.getSystemInfo({
				success: function (res) {
					console.log('systeminfo',res);
					that.globalData.systemInfo = res;
				},
			})
			let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
			this.globalData.menuButtonInfo = menuButtonInfo;
			console.log('menuButtonInfo',menuButtonInfo);
			console.log('userinfo',this.globalData.userInfo);
			console.log('App Show', menuButtonInfo)
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
@font-face {
  font-family: 'iconfont';  /* Project id 3236285 */
  src: url('//at.alicdn.com/t/font_3236285_o0kb15r1g0l.woff2?t=1646903801566') format('woff2'),
       url('//at.alicdn.com/t/font_3236285_o0kb15r1g0l.woff?t=1646903801566') format('woff'),
       url('//at.alicdn.com/t/font_3236285_o0kb15r1g0l.ttf?t=1646903801566') format('truetype');
}
.iconfont{
    font-family:"iconfont" !important;
    font-size:16px;font-style:normal;
    -webkit-font-smoothing: antialiased;
    -webkit-text-stroke-width: 0.2px;
    -moz-osx-font-smoothing: grayscale;
}
	/*每个页面公共css */
</style>
